Home
last modified time | relevance | path

Searched hist:"2 fe03412e2e1be3d5ab37b8351a37c3aec506556" (Results 1 – 1 of 1) sorted by relevance

/linux/mm/
H A Dmemblock.cdiff 2fe03412e2e1be3d5ab37b8351a37c3aec506556 Sun Jan 29 10:00:34 CET 2023 Peng Zhang <zhangpeng.00@bytedance.com> memblock: Avoid useless checks in memblock_merge_regions().

memblock_merge_regions() is called after regions have been modified to
merge the neighboring compatible regions. That will check all regions
but most checks are useless.

Most of the time we only insert one or a few new regions, or modify one or
a few regions. At this time, we don't need to check all the regions. We
only need to check the changed regions, because other not related regions
cannot be merged.

Add two parameters to memblock_merge_regions() to indicate the lower and
upper boundary to scan.

Debug code that counts the number of total iterations in
memblock_merge_regions(), like for instance

void memblock_merge_regions(struct memblock_type *type)
{
static int iteration_count = 0;
static int max_nr_regions = 0;

max_nr_regions = max(max_nr_regions, (int)type->cnt);
...
while () {
iteration_count++;
...
}
pr_info("iteration_count: %d max_nr_regions %d", iteration_count,
max_nr_regions);
}

Produces the following numbers on a physical machine with 1T of memory:

before: [2.472243] iteration_count: 45410 max_nr_regions 178
after: [2.470869] iteration_count: 923 max_nr_regions 176

The actual startup speed seems to change little, but it does reduce the
scan overhead.

Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com>
Link: https://lore.kernel.org/r/20230129090034.12310-3-zhangpeng.00@bytedance.com
[rppt: massaged the changelog]
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>